<docs>
  ## 编辑个人基本信息
</docs>
<template>
  <div class="wrap">
    <div class="tab-wrap">
      <div>
        <router-link :to="{ path: '/person/baseInfo/pBaseInfo'}">
        人员信息
        </router-link>
      </div>
       <div>
          <router-link :to="{ path: '/person/baseInfo/jobIntent'}">
          求职意向
          </router-link>
      </div>
      <div>
        <router-link :to="{ path: '/person/baseInfo/workHistory'}">
          工作经历
        </router-link>
      </div>
      <div class="active">
        <router-link :to="{ path: '/person/baseInfo/schoolExper'}">
          学习经历
        </router-link>
      </div>
      <div>
        <router-link :to="{ path: '/person/baseInfo/otherInfo'}">
          其他信息
        </router-link>
      </div>
    </div>
    <!-- 工作经历开始 -->
    <div class="common" v-for="(item, index) in xxjl" :key="index">
      <div class="title tem_comm">
        <p>学习经历 </p>
        <div class="group">
          <i class="iconfont icon-delete" @click="deleteData(item)"> 删除</i>
          <i class="iconfont icon-edit" @click="editLink(2,item)"> 编辑</i>
        </div>
      </div>
      <div class="edu_list tem_comm">
        <div class="circle"></div>
        <div class="point exper">
          <div class="item">
            <span class="list_l">入学时间</span>
            <span class="list_r">{{item.rxsj}}</span>
          </div>
          <div class="item">
            <span class="list_l duiqi">毕业时间</span>
            <span class="list_r">{{item.bysj}}</span>
          </div>
          <div class="item">
            <span class="list_l">毕业院校</span>
            <span class="list_r">{{item.byyx}}</span>
          </div>
          <div class="item">
            <span class="list_l">备注</span>
            <span class="list_r">{{item.xxjlbz}}</span>
          </div>

        </div>
      </div>
    </div>
    <div style="width:100%; text-align: center">
      <button class="btn addbtn" @click="editLink(1)">新增学习经历</button>
    </div>

  </div>
</template>
<script>
import $ from '@/common/js/axios';
export default {
  name: 'workHistory',
  components: { },
  data() {
    return {
      grqzid: '',
      xxjl: []
    };
  },
  methods: {
    GET_grqzid() {
      this.$loading = true;
      $.get('/grgl/grxqCx').then(res => {
        const data = res.returnData;
        this.grqzid = data.jbxx.grqzid;
        this.GET_getInfo();
      }).finally(() => {
        this.$loading = false;
      });
    },
    GET_getInfo() {
      this.$loading = true;
      $.get('/url/get/grgl_xxjlCx', {params: {
          grqzid:  this.grqzid
        }}).then(res => {
        const data = res.returnData;
        this.xxjl = data.xxjl;
      }).finally(() => {
        this.$loading = false;
      });
    },
    editLink(czlx, item) {
      if (czlx == 1) {
        this.$router.push({ path:'/person/baseInfo/editSchool', query: {grqzid: this.grqzid, ywcz: czlx}})
      } else {
        item.ywcz = czlx;
        this.$router.push({ path:'/person/baseInfo/editSchool', query: item  })
      }
    },
    // 删除
    deleteData(item) {
      item.grqzid = this.grqzid;
      item.ywcz = '0';
      this.$confirm('确定要删除吗？', '提示')
      .then(() => {
        this.$loading = true;
        this.$http.post('/url/post/grgl_xxjlBc', item).then(res => {
          const resData = res.returnData;
          this.$alert(resData.message, () => {
            this.GET_getInfo();
          });
        }).finally(() => {
          this.$loading = false;
        });
      })
      .catch(() => {
        this.$toast('选择了取消');
      });
    }
  },
  created() {
    this.GET_grqzid()


  }
};
</script>
<style scoped lang="scss">
@import '~common/scss/var.scss';
.common {
  min-height: 254px;
  margin: $padding-base;
  background-color: #fff;
  .tem_comm {
    width: 90%;
    margin: 0 auto;
    position: relative;
    p {
      font-size: $font-size-base;
      color: #4a9fe9;
    }
  }
  .title {
    height: 96px;
    line-height: 96px;
    border-bottom: 1px solid #dbdbdb;
  }
  .touxiang {
    height: 289px;
    border-bottom: 1px solid #dbdbdb;
    div {
      width: 160px;
      margin: 0 auto;
      .images {
        width: 160px;
        height: 160px;
        display: inline-block;
        vertical-align: middle;
        margin: 34px auto;
      }
    }
    p {
      font-size: 30px;
      text-align: center;
      color: $color-text-title;
    }
  }
  .point {
    padding: 32px 0;
    border-bottom: 1px dashed #ccc;
    &:last-child {
      border-bottom: 0;
    }
    span {
      display: inline-block;
      line-height: 38px;
    }
    .item {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
    }
    .list_l {
      flex: 0 1 120px;
      color: $color-text-label;
      margin-right: 20px;
    }
    .list_r_fix {
      padding-right: $padding-base * 8;
      box-sizing: border-box;
    }
    .list_l_width {
      flex: 0 1 150px;
    }
    .duiqi {
      text-align-last: justify;
      width: 120px;
    }
    .list_r {
      flex: 1 0 62%;
      width: 62%;
      color: $color-text-title;
      word-wrap: break-word;
    }
    .person {
      margin: 33px 0;
      font-size: 30px;
      color: $color-text-title;
    }
  }
  .edu_list {
    position: relative;
    border-left: 1px dashed $color-help;
    margin-left: 52px;
    margin-top: 30px;
    .exper {
      margin: 0px 0 0 58px;
      p {
        color: $color-text-label;
        line-height: 40px;
      }
      .collage {
        color: $color-text-title;
      }
      .company {
        margin: 50px 0;
      }
    }
    .circle {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background-color: $color-help;
      position: absolute;
      left: -13px;
      top: 0;
    }
  }
  .text {
    line-height: 40px;
    padding-bottom: 20px;
    color: $color-text-label;
  }
  // 基础信息
  .baseinfo {
    position: relative;
    .icon-edit {
      position: absolute;
      right: 0;
      top: 0;
      z-index: 5;
      padding: $padding-base;
    }
  }
}
</style>
